<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '角色';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="backend-user-index">

    <!--    <h1>--><?//= Html::encode($this->title) ?><!--</h1>-->

    <p>
        <?= Html::a('添加角色', ['create-jiaose'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
                'description',
//                'name' ,
                [
                    'attribute' => '备注',
                    'value'=> 'authString',
                ],
//                'type' ,

//                'rule_name' ,
//                'data' ,
//                'created_at' ,
                ['attribute'=>'created_at',
                    'format'=>['date','php:Y-m-d H:i:s'],
                ],
//                'updated_at',
                ['attribute'=>'updated_at',
                    'format'=>['date','php:Y-m-d H:i:s'],
                ],

            [
                'class' => 'yii\grid\ActionColumn',
                'header' => '操作',
                'template'=>' {up-jiaose} {del-jiaose} {up-permission}',
                'buttons'=>
                    [
                        'up-jiaose'=>function($url,$model,$key)
                        {
                            $options=[
                                'title'=>Yii::t('yii', '编辑角色'),
                                'aria-label'=>Yii::t('yii','编辑角色'),
                                'data-method'=>'post',
                                'data-pjax'=>'0',
                            ];
                            return Html::a('<button class="glyphicon glyphicon-pencil btn btn-white btn-sm">编辑</button>',$url,$options);

                        },

                        'del-jiaose'=>function($url,$model,$key)
                        {
                            $options=[
                                'title'=>Yii::t('yii', '删除角色'),
                                'aria-label'=>Yii::t('yii','删除角色'),
                                'data-confirm'=>Yii::t('yii','你确定通过该角色？'),
                                'data-method'=>'post',
                                'data-pjax'=>'0',
                            ];
                            return Html::a('<button class="glyphicon glyphicon-trash btn btn-white btn-sm">删除</button>',$url,$options);

                        },

                        'up-permission'=>function($url,$model,$key)
                        {
                            $options=[
                                'title'=>Yii::t('yii', '分配权限'),
                                'aria-label'=>Yii::t('yii','分配权限'),
                                'data-method'=>'post',
                                'data-pjax'=>'0',
                            ];
                            return Html::a('<button class="glyphicon glyphicon-user btn btn-white btn-sm">分配权限</button>',$url,$options);

                        },
                    ],

            ],
        ],


    ]); ?>

</div>
